package me.zhengjie.modules.vip.domain;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
* @description /
* @author ck
* @date 2024-12-27
**/
@Data
@TableName("member_cards")
public class MemberCards implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "ID")
    private Long id;

    @NotBlank
    @ApiModelProperty(value = "卡号")
    private String cardNo;

    @NotBlank
    @ApiModelProperty(value = "会员卡类型")
    private String cardType;

    @NotNull
    @ApiModelProperty(value = "会员ID")
    private Long memberId;

    @ApiModelProperty(value = "所属宠物ID")
    private Long petId;

    @ApiModelProperty(value = "有效期结束时间")
    private Timestamp validEndTime;

    @ApiModelProperty(value = "充值次数")
    private Integer rechargeCount;

    @ApiModelProperty(value = "赠送次数")
    private Integer giftCount;

    @ApiModelProperty(value = "支付方式")
    private String paymentMethod;

    @NotNull
    @ApiModelProperty(value = "收取金额")
    private BigDecimal amount;

    @ApiModelProperty(value = "状态：NORMAL-正常 EXPIRED-已过期 DISABLED-已禁用")
    private String status;

    @ApiModelProperty(value = "备注")
    private String remarks;

    @ApiModelProperty(value = "创建者")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    @ApiModelProperty(value = "更新者")
    @TableField(fill = FieldFill.UPDATE)
    private String updateBy;

    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    @ApiModelProperty(value = "累计充值金额")
    private BigDecimal totalRechargeAmount;

    @ApiModelProperty(value = "累计赠送金额")
    private BigDecimal totalGiftAmount;

    @ApiModelProperty(value = "会员等级")
    @TableField(exist = false)  
    private String levelName;

    public void copy(MemberCards source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
